﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.Crc.ResManage.DAL.EquipManage;
using Com.Crc.PoJo.Model.Resource;
using Com.Crc.ResManage.BLL.EquipManage;
using System.Data;
using System.Collections;


namespace Com.Crc.ResManage.BLL.EquipManage
{
    public class ONUManageBLL
    {


        ONUManagerDAL dal = new ONUManagerDAL();

        /// <summary>
        /// 新增ONU设备信息
        /// </summary>
        /// <param name="data">model实体</param>
        /// <returns></returns>
        public bool AddONUData(ONUEntity data)
        {
            try
            {
                return dal.AddONUData(data);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }

        /// <summary>
        /// 修改ONU设备信息
        /// </summary>
        /// <param name="data">model实体</param>
        /// <returns></returns>
        public bool UpdateONUData(ONUEntity data)
        {
            try
            {
                return dal.UpdateONUData(data);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }

        /// <summary>
        /// 查询ONU设备信息
        /// </summary>
        /// <param name="strBranchID">分局ID</param>
        /// <param name="strOfficeID">局点ID</param>
        /// <param name="strSubDistrictID">小区ID</param>
        /// <param name="strEquipID">设备ID</param>
        /// <returns></returns>
        public DataTable QueryONUData(string strBranchID, string strOfficeID, string strSubDistrictID,string strEquipID)
        {
            try
            {
                return dal.QueryONUData(strBranchID, strOfficeID, strSubDistrictID,strEquipID);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return null;
            }
        }

        /// <summary>
        /// 删除设备，修改状态位
        /// </summary>
        /// <param name="wlanList"></param>
        /// <returns></returns>
        public bool DeleteOLTData(ArrayList onuList)
        {
            try
            {
                return dal.DeleteONUData(onuList);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }
        /// <summary>
        /// 工单建立时分配端口
        /// </summary>
        /// <param name="onuId"></param>
        /// <param name="subdistrictId"></param>
        /// <returns></returns>
        public int usePort(int onuId, int subdistrictunitId)
        {
            return dal.usePort(onuId, subdistrictunitId);
        }

        ///// <summary>
        ///// 新增ONU端口信息
        ///// </summary>
        ///// <param name="data">model实体</param>
        ///// <returns></returns>
        //public bool AddONUPortData(ONUPortEntity data)
        //{
        //    try
        //    {
        //        return dal.AddONUPortData(data);
        //    }
        //    catch (Exception ex)
        //    {
        //        string strError = ex.Message.ToString();
        //        return false;
        //    }
        //}

        /// <summary>
        /// 修改ONU端口信息
        /// </summary>
        /// <param name="data">model实体</param>
        /// <returns></returns>
        public bool UpdateONUPortData(ONUPortEntity data)
        {
            try
            {
                return dal.UpdateONUPortData(data);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }

        /// <summary>
        /// 删除端口，修改状态位
        /// </summary>
        /// <param name="wlanList"></param>
        /// <returns></returns>
        public bool DeleteOLTPortData(ArrayList onuList)
        {
            try
            {
                return dal.DeleteONUPortData(onuList);
            }
            catch (Exception ex)
            {
                string strError = ex.Message.ToString();
                return false;
            }
        }

    }
}
